package com.hutao.medical.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hutao.medical.dataSource.TargetDataSource;
import com.hutao.medical.mapper.dic.DicMapper;
import com.hutao.medical.service.BasicService;

@Service
public class BasicServiceImpl implements BasicService {

	@Autowired
	private DicMapper dicMapper;
	
	
	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getInHospitalState() {
		return dicMapper.getInHospitalState();
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getHospitalOffice() {
		return dicMapper.getHospitalOffice();
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getOutHospitalType() {
		return dicMapper.getOutHospitalType();
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getDiagnoseType() {
		return dicMapper.getDiagnoseType();
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getInHospitalType() {
		return dicMapper.getInHospitalType();
	}

	@Transactional(readOnly = true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getWayOfPayingType() {
		return dicMapper.getWayOfPayingType();
	}

	
	@Override
	public List<Map<String, Object>> getAuditStandard(String name) {
	
		return dicMapper.getAuditStandard(name);
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public Map<String,List<Map<String,Object>>> getBasicInfoList() {
		Map<String,List<Map<String,Object>>> basicInfoMap = new HashMap<>();
		List<Map<String,Object>> outOfficeList= dicMapper.getOutHospitalOffice();
		basicInfoMap.put("outOfficeList",outOfficeList);
		List<Map<String,Object>> inHospitalStateList = dicMapper.getInHospitalState();
		basicInfoMap.put("inHospitalStateList",inHospitalStateList);
		List<Map<String,Object>> sexList = dicMapper.getSexs();
		basicInfoMap.put("sexList",sexList);
		List<Map<String,Object>> professionList = dicMapper.getProfession();
		basicInfoMap.put("professionList",professionList);
		List<Map<String,Object>> outHospitalTypeList = dicMapper.getOutHospitalType();
		basicInfoMap.put("outHospitalTypeList",outHospitalTypeList);
		List<Map<String,Object>> paymentTypeList = dicMapper.getPaymentType();
		basicInfoMap.put("paymentTypeList",paymentTypeList);
	 	List<Map<String,Object>> marriageList = dicMapper.getMarriage();
	 	basicInfoMap.put("marriageList",marriageList);
		return basicInfoMap;
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getOperationList() {
		return dicMapper.getOperationList();
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getDiseaseList(String queryName) {
		
		return dicMapper.getDiseaseByCodeOrName(queryName);
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getOperationList(String queryName) {
		return dicMapper.getOperationByCodeOrName(queryName);
	}

	
	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getSexNameList(String queryName) {
		
		return dicMapper.getSexNameList(queryName);
	}

	
	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getInHospitalStateList(String queryName) {
		return dicMapper.getInHospitalStateList(queryName);
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getPaymentTypeList(String queryName) {
		return dicMapper.getPaymentTypeList(queryName);
	}

	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getDeptNameList(String queryName) {
		return dicMapper.getDeptNameList(queryName);
	}

	
	@Transactional(readOnly=true)
	@TargetDataSource(name="ds1")
	@Override
	public List<Map<String, Object>> getOutHospitalTypeList(String queryName) {
		return dicMapper.getOutHospitalTypeList(queryName);
	}


}
